<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<link rel="stylesheet" type="text/css" href="css/news.css">
</head>
<body>
	<div class="bannerS">
		
		<!-- 导航栏 -->
	<div class="nav ">
		<div class="banner">
			<img src="https://www.buchouwang.com/img/logo.a2dacc49.png">
		</div>
		<div class="nav-center">
			<a href="./index.html" class="item-on">首页 <span></span></a>
			<a href="./po.html" class="product">产品介绍 <span></span>
				<div class="Invisibility">
				<div class="subnav"></div>
			</div>
			</a>
			
			<a href="">解决方案 <span></span></a>
			<a href="">案例展示 <span></span></a>
			<a href="" class="news1">新闻中心 
				<span></span>
				<div class="Invisibility2">
				<div class="subnav2" onclick="subnav2(1)">
					<div class="first-nav">
						<img src="./img/3.png">
						<p>公司动态</p>
					</div>
					<div class="secone-nav">
						<img src="./img/4.png">
						<p>行业动态</p>
					</div>
				</div>
				</div>
			</a>
			<a href="">关于我们 <span></span></a>
			<a href="">加入我们 
				<span></span>
			</a>
			<a href="">生猪交易 <span></span></a>
			<a href="">申请演示 <span></span></a>
		</div>
        	
	</div>
	<div class="bantie">
			<div class="bancon">
				<div class="banner-title">公司动态</div>
				<div class="banner-info">公司动态</div>
			</div>
		</div>
</div>
	<div class="detail-wrap">
		<div class="center-wrap">
			<div class="detail-title">
				首页>
				<span>公司动态</span>
			</div>
			
		</div>
	</div>
	
	<script type="text/javascript" src="ajax.js"></script>
	<script type="text/javascript" src="jquery-3.2.1.js"></script>
	<script type="text/javascript">
		console.log(location.href)
		let id = location.href.split('=')[1];
		function subnav2(id2){
			location.href = `news2.html?id2=${id2}`
		}



			//二级导航
			let subnav = document.querySelector(".subnav")
			ajax({
			  method: "get",
			  url: "stage-api/website/getProductMenuInfo",
			}).then(res => {
			  for(let i = 0; i < res.data.length; i++){
			    if (i == 4) {
			      continue;
			    }else if(i == 6){
			      continue;
			    }else{
			      subnav.innerHTML += `<div class="subtag" onclick=detail('${res.data[i].productId}')>
			                            <img src=${res.data[i].menuIcon.split("?")[0]}>
			                            <p>${res.data[i].productName}</p >
			                            </div>`
			    }
			  }
			})

			  function detail(productId){
			    location.href = `po.html?productId=${productId}`
			  }
			  $(".product").hover(function(){
				  $(".Invisibility").css("display", "block")
				}, function(){
				  $(".Invisibility").css("display", "none")
				})
			  $(".news1").hover(function(){
				  $(".Invisibility2").css("display", "block")
				}, function(){
				  $(".Invisibility2").css("display", "none")
				})

			  	console.log(location.href.split("=")[1])
				let id = location.href.split("=")[1]


				let lefttitle = document.querySelector('.body-left-title')
				let lefttext = document.querySelector('.body-left-text')
				ajax({
				  method: "get",
				  url: "stage-api/website/getNewDetails",
				  params:{
				    newsId: id,
				  },
				})
				.then(res => {
				    lefttitle.innerText = `${res.data.newsName}`
				    lefttext.innerHTML =  `${res.data.newsIntroduce}`
				  })

			  //案例展示
	
	</script>
</body>
</html>